home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------;; HOSTSPEC.ASM ;; Written By: Keith Larson ;; TMS320Cxx DSP Applications Engineer ;; Texas Instruments ;; ;; USE WITH THE DSKL [G]RAPH OPTION. THIS OPTION IS DESIGNED;; TO RECEIVE A BYTE FROM THE DSK AND OUTPUT IT GRAPHICLY. ;; RUNNING THIS PROGRAM ON DSKD WILL CRASH THE DEBUGGER! ;; ;; A spectrum analyzer using the DSK and your Host PC. ;; This code does NOT work with DSKD! It is run from within ;; DSKL using DSK_COMM to send data to the host via the RS232;; link. It is slower than DSK_SPEC, but you do not need an ;; oscilliscope! ;; ;; To run this program, first assemble it using DSKA. ;; Then start DSKL, select 'X' for load and execute. Then ;; select 'G' for graphics. To exit, hit any key (except Q) ;; since the keyboard is not flushed and 'Q' will quit DSKL ;; entirely! ;;-----------------------------------------------------------;YES .set 1 ;NO .set 0 ;FFT_S .set 256 ;;-----------------------------------------------------------;AIC_1 .set 0x0C18 ;TB =TA = 6 0000110000011000=0x0C18AIC_2 .set 0x0205 ;TA'=TA'= 1 0000001000000101=0x0205AIC_3 .set 0x264e ;RB =TB = 0x13 0010011001001110=0x264c 44 khzAIC_CMD .set 0x0003 ; COMMAND 0000000000000011=0x0083;-----------------------------------------------------------;BCMD .set 0xFA10 ;JUMP CMDBXMIT .set 0xFA12 ;JUMP XMITBXMIT16 .set 0xFA14 ;JUMP XMIT16BRECV .set 0xFA16 ;JUMP RECVBRECV16 .set 0xFA18 ;JUMP RECV16BCXMIT .set 0xFA1A ;JUMP CXMIT;----------------------------------------------------------STAT1 .set 0x72 ;ACCU_lo .set 0x78 ;ACCU_hi .set 0x79 ;REAL .set 0x7a ;IMAG .set 0x7b ;TEMPX .set 0x7c ;AUX0 .set 0x7dAUX1 .set 0x7e;----------------------------------------------------------------; SECONDARY VECTOR TABLE LOACTED IN B0 PROGRAM RAM;---------------------------------------------------------------- .include "mmregs.inc" ; > USERCODE SHOULD NOT OVERWRITE DSKD < .ps 0xfa00 ; > VECTORS. ON LOAD, INT2 IS RESTORED < ;B start ;RS > BY DSKD, BUT TRAP IS NOT < ;B start ;INT0 ;B start ;INT1 ;B start ;INT2 > DSKD LOAD IGNORES INT2 VECTOR ;B start ;TINT .ps 0fa0ah ; B RINT ;RINT Branch to receive interrupt routine eint ;XINT XINT is only for timing, so just return ret ; ; Begin TRAP/DSKD Kernal ;DSKD load does not restore this code!;----------------------------------------------------------------; APPLICATION CODE IS LOCATED ABOVE DSKD KERNAL;---------------------------------------------------------------- .ps 0xFB00 ; .entry ;;----------------------------------------------------------------start: sxf ssxm sovm ; catch accumulator overflows ldpk 0 ; All direct addressing is to MMRs and B2 fort 0 ; Serial port : 16 bit rtxm ; : ext. FSX sfsm ; ; burst mode lack 0x80 ; AIC reset by pulsing /BR (Global Data) sach DXR ; send 0 to DXR (AIC) sacl GREG ; 256 * 100 nS /BR pulse lrlk AR0,0xFFFF ; rptk 255 ; read junk from address 0xFFFF lac *,0,AR0 ; conf 1 ; B1,B3 as DRAM if direct bootload;--------------------------------AIC_RS lack 0x20 ; Turn on XINT sacl IMR ; idle ; lalk AIC_1 ; Load each AIC configuration word call AIC_2nd ; and load it into the AIC lalk AIC_2 ; call AIC_2nd ; lalk AIC_3 ; call AIC_2nd ; lalk AIC_CMD ; call AIC_2nd ;;---------------------------------------------------------------- lark AR7,0 ; Buffer initialy filled lack 0x10 ; AIC RINT sacl IMR ; where INT0 indicates EOC (End Of Conv) ;--------------------------------------------------------------- lark AR7,0 ; Buffer initialy filledFFT: lrlk AR0,FFT_S/2 ; larp AR0 ; start FFT with AR0=FFTSizenew_stg lrlk AR1,_D_base ; AR1 is the TOP BFLY address lrlk AR2,_D_base ; AR2 is the BOT BFLY address lrlk AR3,_T_base+1 ; AR3 is the TWiddle pointer lrlk AR4,FFT_S/2 ; AR4 counts DFT blocks b n_DFT2,*,AR1 ;DFT: mar *BR0+,AR5 ; complete circular buffer for TW's lark AR5,1 ; set up DFT loop with *BR0+/BANZ mar *BR0+,AR1 ; using 1 cuts *BR0+ loop in half! ;---------------------------------------- ; AR1=Top AR2=Bottom AR3=Twiddle ;----------------------------------------BFLY: lac *,14,AR2 ;(imag1+imag2)/4 add *,14,AR1 ; sach *+,1,AR2 ;store TOP imag sub *,15 ;(imag1-imag2)/2 sach *+,1,AR1 ;store BOT imag lac *,14,AR2 ;(real1+real2)/4 add *,14,AR1 ; sach *+,1,AR2 ;store TOP real sub *,15 ;(real1-real2)/2 sach *,1,AR5 ;store BOT real banz OK,*BR0+,AR3 ;If at DFT end quit early ;------------------------ mar *+,AR2 ;clean up TW base (xxx0000+1) mar *+ ;modify BOTom DATA pointer mar *0+ ; mar *0+,AR1 ;n_DFT2: mar *0+ ;modify the TOP pointer mar *0+,AR4 ; banz DFT,*0-,AR3 ;dec DFT block count AR4 by OFFset larp AR0 ; mar *BR0+ ; banz new_stg,* ;if OFFset was 1, now cleared b endFFT ; ;-------------------------OK lt *-,AR2 ;TREG=TWR *NOTE* Twiddles are Q15 mpy *- ;PREG=REAL*TWR ltp *+,AR3 ;TREG=IMAG ACCU=REAL*TWR mpy * ;PREG=IMAG*TWI AR2=R AR3=I lts *+,AR2 ;TREG=TWI ACCU=REAL*TWR-IMAG*TWI mpy * ;PREG=REAL*TWI sach *-,1,AR2 ;<<; ltp *,AR3 ;TREG=IMAG ACCU=REAL*TWI mpy *BR0+,AR2 ;PREG=IMAG*TWR apac ; ACCU=IMAG*TWR+REAL*TWI sach *+,1,AR2 ;<<; b BFLY,*+,AR1 ; ;------------------------------------------------------------endFFT: larp AR2 ;Transform REAL & IMAG to log magnitude lrlk AR2,_D_base ;AR3=FFT data pointer lrlk AR3,FFT_S-1 ;AR5=FFT loop counter lrlk AR0,FFT_S ;-----------------------------------------------------------; ; WINDOW: Performs post FFT raised cosine windowing! ; ; This is done by using the frequency coefficients of the ; ; window in a convolution filter of the spectrum. ; ;-----------------------------------------------------------; ;mar *BR0+ ; don't start at DCmore_MAG mar *BR0- ; -IMAG[-1] 1-COS(nwt/N) + 1 lac *BR0+,15 ; IMAG[-0] filter by post | subh *BR0+ ;ˇ¯©Ép∞nˇfFBß?<∏Bßpˇ/ ©|-_ˇ¸Hnˇ¸/<